package com.sdi.columbus;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ListView;

public class ReportList extends ListActivity {
	

    Intent news;
    Bundle bun;
    GpsData gpsd=new GpsData();
	
    String[] regno=null;
	String[] vname=null;
	String[] VehicleNames=new String[gpsd.getSize()];
	String[] VehicleYOMs=new String[gpsd.getSize()];
	String[] VehicleMake=new String[gpsd.getSize()];
	String[] VehicleRegNo=new String[gpsd.getSize()];
//	int[] VehicleIds=new int[gpsd.getSize()];
	String[] VehicleIds=new String[gpsd.getSize()];
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		vname = new String[gpsd.getSize()];
		regno = new String[gpsd.getSize()];
		

		 regno=gpsd.getVehicleRegNo();
		 vname=gpsd.getVehicleModel();
		 VehicleIds=gpsd.getVehicleIds();
		setListAdapter(new Report(this, vname));
		System.out.println(">>>>>>>>>>>>>>>"+regno);
		Log.d("REG NO", ">>>>>>>>"+regno);
		
		

	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {

		//get selected items
		String selectedValue = (String) getListAdapter().getItem(position);
		//Toast.makeText(this, selectedValue, Toast.LENGTH_SHORT).show();
		int index=position;
//		int ids=VehicleIds[index];
		String ids=VehicleIds[index];
		System.out.println(" Selected Vehicle ID : "+ids);
		news=new Intent(ReportList.this,GetReportDate.class);
		bun=new Bundle();
//		bun.putInt("vehicleids",ids);
		bun.putString("vehicleids", ids);
		news.putExtras(bun);
		startActivity(news);

	}

}

